package com.gcl.usercenter.common;

import lombok.Data;

import java.io.Serializable;

/**
 * 通用返回类
 *
 * @param <T>
 */
@Data
public class BaseResponse<T> implements Serializable {
    private static final long serialVersionUID = 137426055195258839L;
    private int code;
    private T date;
    private String message;
    private String description = "";

    public BaseResponse(int code, T date, String message, String description) {
        this.code = code;
        this.date = date;
        this.message = message;
        this.description = description;
    }

    public BaseResponse(int code, T date, String message) {
        this.code = code;
        this.date = date;
        this.message = message;
    }

    public BaseResponse(int code, String message, String description) {
        this(code,null,message, description);
    }
    public BaseResponse(ErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.date = null;
        this.message = errorCode.getMessage();
    }

}
